package mediator;

public class Client
{
	public static void main(String args[])
	{
		MessageMediator chatroom = new ChatroomMediator();

		ChatParticipant zhangsan = new VipParticipant("张三");
		ChatParticipant lisi = new RegularParticipant("李四");
		ChatParticipant wangwu = new VipParticipant("王五");

		chatroom.registerParticipant(zhangsan);
		chatroom.registerParticipant(lisi);
		chatroom.registerParticipant(wangwu);

		// 测试消息发送
		zhangsan.sendTextMessage("李四", "你好，李四！");
		lisi.sendTextMessage("张三", "你好，张三！");
		lisi.sendImageMessage("张三", "photo.jpg");  // 会被拒绝
		zhangsan.sendImageMessage("李四", "sunset.jpg");

		// 查看消息历史
		System.out.println("\n=== 李四的消息历史 ===");
		lisi.getMessageHistory().forEach(System.out::println);
	}

}